from base64 import b64encode
import os

cur_file_path, filename = os.path.split(os.path.abspath(__file__))

for fname in os.listdir(cur_file_path):
    if fname[-2:] == 'so':
        with open(f'{cur_file_path}/{fname}', 'rb') as fp:
            libname = fname[:-3]
            with open(f'{cur_file_path}/../l0n0lnet/{libname}.py', 'w') as wfp:
                data = b64encode(fp.read()).decode()
                wfp.write(rf'lib = """{data}"""')
